<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: index.tpl 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<?php 
	$this->headLink()
  ->appendStylesheet($this->seaddonsBaseUrl()
    . '/application/modules/Sitealbum/externals/styles/style_sitealbum.css')
?>
<?php
$photoSettings=  array();
$photoSettings['class'] = 'thumb';
if($this->showLightBox):
include_once APPLICATION_PATH . '/application/modules/Sitealbum/views/scripts/_lightboxPhoto.tpl';
endif;
?>
<?php if (empty($this->is_ajax)) : ?>
	<h3><?php echo $this->translate("Friends’ Photos") ?></h3>
	<ul id='friends-photos' class="generic_list_widget generic_list_widget_large_photo">
<?php endif; ?>
  <?php
		foreach( $this->friendsPhoto as $item ):?>
     <?php if($this->showLightBox):
  $photoSettings["onclick"]="openLightBoxAlbum('".$item->getPhotoUrl()."','".Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($item)."');return false;";
  endif; ?>
    <li>
      <div class="photo">
        <?php echo $this->htmlLink($item->getHref(), $this->itemPhoto($item, 'thumb.normal'), $photoSettings) ?>
      </div>
      <div class="info">
        <div class="title">
          <?php echo $this->htmlLink($item->getHref(), $this->string()->truncate($item->getTitle(), 13)) ?>
        </div>

        <div class="owner">
          <?php
            $owner = $item->getOwner();
            $parent = $item->getParent();
            echo $this->translate('By %1$s in %2$s',
                $this->htmlLink($owner->getHref(), $owner->getTitle()),
                $this->htmlLink($parent->getHref(), $parent->getTitle()));
          ?>
        </div>
      </div>
    </li>
  	<?php endforeach; ?>
    <li>
      <div id="friend_photo_loding_image" style="display: none;" class="seaddons_sidebar_more_link"> 
      	<img src="application/modules/Core/externals/images/loading.gif" alt="" class="sitealbum_sidebar_loader_img" />
      </div>
      <a id="friend_photo_see_more" onclick="SeeMorePhoto();" href="javascript:void(0);" class="seaddons_sidebar_more_link"><?php echo $this->translate('See More')?></a>
    </li>
<?php if (empty($this->is_ajax)) : ?>
	</ul>
<?php endif; ?>
<script type="text/javascript">
  var submit_topageprofile = true;
  function SeeMorePhoto()
  {
    submit_topageprofile = false;
    $('friend_photo_see_more').style.display='none';
    $('friend_photo_loding_image').style.display='block';
    en4.core.request.send(new Request.HTML({
      method : 'post',
      'url' : en4.core.baseUrl + 'widget/index/mod/sitealbum/name/friends-photos',
      'data' : {
        format : 'html',
        isajax : 1      
      },
      onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
        $('friend_photo_see_more').style.display='block';
        $('friend_photo_loding_image').style.display='none';
        $('friends-photos').innerHTML=responseHTML;
        var friendPhotoscontainer = $('friends-photos').getElement('.layout_sitealbum_friends_photos').innerHTML;
        $('friends-photos').innerHTML = friendPhotoscontainer;
      }
    }));

    return false;

  }
  </script>